package m.jclecai.com.adapter.holder;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.view.View;
import android.widget.RelativeLayout;

import butterknife.ButterKnife;
import m.jclecai.com.MyApplication;

/**
 * Created by ZD on 2017/5/4.
 */

public class ViewHolder extends RelativeLayout {
    protected View mView;

    public View getView() {
        return mView;
    }

    public ViewHolder(Context context, @LayoutRes int resource) {
        super(context == null ? MyApplication.getAppContext() : context);
        this.mView = inflate(context == null ? MyApplication.getAppContext() : context, resource, this);
        ButterKnife.bind(this,mView);
    }

    @SuppressWarnings("unchecked")
    public <T> T getViewById(int redId) {
        return (T) findViewById(redId);
    }
}
